package thread;

public class HW5 {
    private static Object locker1 = new Object();
    private static Object locker2 = new Object();
    public static void main(String[] args) {
        Thread a = new Thread(()->{
           synchronized (locker2){
               try {
                   locker2.wait();
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("a");
        });
        Thread b = new Thread(()->{
            synchronized (locker1){
                try {
                    locker1.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("b");
            synchronized (locker2){
                locker2.notify();
            }
        });
        Thread c = new Thread(()->{
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("c");
            synchronized (locker1){
                locker1.notify();
            }
        });

        a.start();
        b.start();
        c.start();
    }
}
